package com.jiangchuang.controller;

import com.jiangchuang.domain.Result;
import com.jiangchuang.service.IReviewService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/api")
@Api(tags = "审核管理")
@RestController
public class ReviewController {
    @Autowired
    private IReviewService reviewService;

    @ApiOperation(value = "获取待审核图片信息")
    @GetMapping("/getImgInfo")
    public Result getImgInfo(Integer id){
        return Result.ok(reviewService.getImgInfo(id));
    }

    @ApiOperation(value = "人工审核图片 reviewStatus:3-违规，4-通过")
    @PostMapping("/reviewImg")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "审核表id")
    })
    private Result reviewImg(Integer id, Integer reviewStatus){
        reviewService.reviewImg(id,reviewStatus);
        return Result.ok();
    }

    @ApiOperation(value = "图片违规")
    @PostMapping("/violateImg")
    private Result violateImg(String imgUrl){
        reviewService.violateImg(imgUrl);
        return Result.ok();
    }

    @PostMapping("/replaceDomian")
    @ApiOperation(value = "oss域名更换为sanshipu")
    private Result replaceDomian(int idx, int num){
        reviewService.replaceDomian(idx, num);
        return Result.ok();
    }

}
